package com.qf.boot2202day03.vo;

import com.qf.boot2202day03.utils.Constants;

import java.util.HashMap;

public class ReturnVo extends HashMap {


    public static ReturnVo ok(){

        final ReturnVo returnVo = new ReturnVo();
        returnVo.put("code", Constants.SUCCESS_CODE);
        returnVo.put("msg","ok");

        return returnVo;
    }

    public static ReturnVo fail(){

        final ReturnVo returnVo = new ReturnVo();
        returnVo.put("code", Constants.FAIL_CODE);
        returnVo.put("msg","fail");

        return returnVo;
    }

    public static ReturnVo fail(String msg) {

        final ReturnVo returnVo = new ReturnVo();
        returnVo.put("code", Constants.PARAM_NULL_CODE);
        returnVo.put("msg",msg);

        return returnVo;
    }
}
